import request from '@/utils/request';
import {AxiosPromise} from 'axios';
import {CreateEntityRequestVO, RepoGroupOption, RepoGroupPageResult, RepoGroupQueryParam,} from './types';

export function queryEntityPages(queryParams: RepoGroupQueryParam): AxiosPromise<RepoGroupPageResult> {
    return request({
        url: '/manager/repository/group/user/page',
        method: 'post',
        data: queryParams,
    });
}

export function deleteEntity(data: CreateEntityRequestVO) {
    return request({
        url: '/manager/repository/group/user/entity',
        method: 'delete',
        params: {
            id: data.id,
        },
    });
}

/**
 * 添加实体
 *
 * @taskParam data
 */
export function createEntity(data: CreateEntityRequestVO) {
    return request({
        url: '/manager/repository/group/user/entity',
        method: 'post',
        data: data,
    });
}

/**
 * 添加实体
 *
 * @taskParam data
 */
export function insertRepoGroupMember(data: CreateEntityRequestVO) {
    return request({
        url: '/manager/repository/group/member',
        method: 'post',
        data: {
            id: data.id,
            member: data.member
        },
    });
}


/**
 * 添加实体
 *
 * @taskParam data
 */
export function deleteRepoGroupMember(data: CreateEntityRequestVO) {
    return request({
        url: '/manager/repository/group/member',
        method: 'delete',
        params: {
            id: data.id,
            member: data.member
        },
    });
}

